{include file="public/header" /}
<form class="layui-form" style="padding:0 20%;">
	<div class="layui-tab">
		<ul class="layui-tab-title">
			<li class="layui-this">个人信息</li>
			<li>密码信息</li>
			<li>其它信息</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<div style="padding:15px;">
					<label class="layui-form-label">账户</label>
					<div class="layui-input-block">
						<div class="layui-form-label" style="color:#f05050;text-align:left;width:100%;">
							{$user.username}</div>
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">说明</label>
					<div class="layui-input-block">
						<div class="layui-form-label" style="width:100%;text-align:left;color:#999;">账户用于登录系统的账号，不能修改
						</div>
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">姓名</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="name" placeholder="请输入真实姓名" value="{$user.name}">
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">昵称</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="nickname" placeholder="请输入昵称"
							value="{$user.nickname}">
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">手机号</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="contact_phone" placeholder="请输入手机号"
							value="{$user.contact_phone}">
					</div>
				</div>
			</div>
			<div class="layui-tab-item">
				<div style="padding:15px;">
					<label class="layui-form-label">老密码</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="old_password" placeholder="请输入老密码，不修改不填写">
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="new_password" placeholder="请输入新密码，不修改不填写">
					</div>
				</div>
			</div>
			<div class="layui-tab-item">
				<div style="padding:15px;">
					<label class="layui-form-label">登录次数</label>
					<div class="layui-input-block">
						<div class="layui-form-label" style="text-align:left;width:100%;">{$user.login_times}次</div>
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">注册时间</label>
					<div class="layui-input-block">
						<div class="layui-form-label" style="text-align:left;width:100%;">{:date('Y-m-d
							H:i:s',$user.create_time)}</div>
					</div>
				</div>
				<div style="padding:15px;">
					<label class="layui-form-label">登录时间</label>
					<div class="layui-input-block">
						<div class="layui-form-label" style="text-align:left;width:100%;">{:date('Y-m-d
							H:i:s',$user.last_time)}</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="layui-form-item" style="margin-top:10px;padding:0 10%;">
		<button type="button" class="layui-btn layui-btn-fluid" onclick="save()">保存个人信息</button>
	</div>
</form>

<script type="text/javascript">
	layui.use(['layer', 'form', 'element'], function () {
		var form = layui.form;
		element = layui.element;
		layer = layui.layer;
		$ = layui.jquery;
	});
	function save() {
		$.post("{$config.path}user/info", $('form').serialize(), function (res) {
			if (res.error_code == 0) {
				layer.msg(res.msg, { 'icon': 1 });
				setTimeout(function () {
					window.location.reload();
				}, 1000);
			} else {
				layer.msg(res.msg, { 'icon': 2 });
			}
		}, 'json').error(function (res) {
			layer.msg(res.responseJSON.msg, { 'icon': 2 });
		});
	}
</script>